#pragma once

#include <inference_engine.hpp>
#include <opencv2/opencv.hpp>

struct ObjectDetector {

    struct Result {
        size_t id, type;
        float conf, x, y, w, h;
        Result (size_t i, size_t t, float c, float x, float y, float w, float h)
        : id(i), type(t), conf(c), x(x), y(y), w(w), h(h) {}
    };

    ObjectDetector (InferenceEngine::Core &ie, const std::string &device, const std::string &model);

    std::vector<Result> infer (const cv::Mat &frame, float confidence = 0.6);

    static void input (const cv::Mat &src, InferenceEngine::Blob::Ptr &dst);

    static void output (const InferenceEngine::Blob::Ptr &src, std::vector<Result> &dst, float confidence);

private:
    InferenceEngine::ExecutableNetwork net;
    std::string inputName;
    std::string outputName;
};